import { Observable, of, isObservable } from 'rxjs';
import { take } from 'rxjs/operators';

export interface TagItem {
  label: any;
  value?: string; // 标签选项的标识
  /** @deprecated: 平滑过渡，使用disabled替代，后续删除 */
  disabeld?: boolean;
  disabled?: boolean;
  /** @deprecated: 平滑过渡，使用removable替代，后续删除 */
  removeable?: boolean;
  removable?: boolean;
}

export type TagEventOutput = boolean | void | Observable<boolean>;

export function getBeforeStream(source: any): any {
  if (isObservable(source)) {
    return source.pipe(take(1));
  }
  return of(source);
}
